package cn.com.lms.business.examRewrite.service;

import cn.com.lms.business.examRewrite.persistence.entity.PaperSubjectReWrite;
import cn.com.lms.business.examRewrite.persistence.repository.PaperSubjectReWriteDao;
import com.bnzj.core.persistence.BaseService;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class PaperSubjectReWriteService extends BaseService<PaperSubjectReWriteDao, PaperSubjectReWrite,Long> {
    /**
     * 通过id和is_delete获取固定试卷的数据
     * @param id
     * @param is_delete
     * @return
     */
    public List<PaperSubjectReWrite> findByIdAndIsDelete(Long id, boolean is_delete) {
        return repository.findByIdAndIsDelete(id,is_delete);
    }

    /**
     * 通过id删除数据
     * @param id
     */
    public void deleteById(Long id) {
        repository.deleteById(id);
    }

    /**
     * 通过paperId获取固定详情数据
     * @param id
     * @return
     */
    public List<Map<String, Object>> findPaperScoreByPaperIdList(Long id) {
        return repository.findPaperScoreByPaperIdList(id);
    }

    /**
     * 通过PaperId删除
     * @param result
     * @param ids
     */
    public void deletePaperSubjectReWriteByPaperId(boolean result, List<Long> ids) {
        repository.deletePaperSubjectReWriteByPaperId(result,ids);
    }
}
